package com.shaw.tiger;

public class NameRepository<T> implements Container {

	public T names[];

	public T[] getNames() {
		return names;
	}

	public void setNames(T[] i) {
		this.names = i;
	}

	@Override
	public Iterator<T> getIterator() {
		return new NameIterator<T>();
	}

	private class NameIterator<T> implements Iterator<T> {
		int index;

		@Override
		public boolean hasNext() {
			if (index < names.length) {
				return true;
			}
			return false;
		}

		@Override
		public T next() {
			if (hasNext()) {
				return ((T) getNames()[index++]);
			}
			return null;
		}
	}
}
